package com.platform.usercenter.enums;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

@Getter
public enum DayNameEnum {

    DAY_NAME_ENUM_MONDAY(1,"周一"),
    DAY_NAME_ENUM_TUESDAY(2,"周二"),
    DAY_NAME_ENUM_WEDNESDAY(3,"周三"),
    DAY_NAME_ENUM_THURSDAY(4,"周四"),
    DAY_NAME_ENUM_FRIDAY(5,"周五"),
    DAY_NAME_ENUM_SATURDAY(6,"周六"),
    DAY_NAME_ENUM_SUNDAY(0,"周日");

    private Integer code;

    private String name;

    DayNameEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByValue(Integer value) {
        if (value == null){
            return null;
        }
        for (DayNameEnum option : DayNameEnum.values()) {
            if (option.getCode() == value ) {
                return option.getName();
            }
        }
        return null;
    }

}
